package model

import "github.com/zeromicro/go-zero/core/stores/sqlx"

var _ WordsModel = (*customWordsModel)(nil)

type (
	// WordsModel is an interface to be customized, add more methods here,
	// and implement the added methods in customWordsModel.
	WordsModel interface {
		wordsModel
		withSession(session sqlx.Session) WordsModel
	}

	customWordsModel struct {
		*defaultWordsModel
	}
)

// NewWordsModel returns a model for the database table.
func NewWordsModel(conn sqlx.SqlConn) WordsModel {
	return &customWordsModel{
		defaultWordsModel: newWordsModel(conn),
	}
}

func (m *customWordsModel) withSession(session sqlx.Session) WordsModel {
	return NewWordsModel(sqlx.NewSqlConnFromSession(session))
}
